# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-orjson
pkgver=3.10.11
pkgrel=0
pkgdesc="Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
url="https://github.com/ijl/orjson"
arch="all"
license="Apache-2.0 AND MIT"
makedepends="
	cargo
	py3-gpep517
	py3-maturin
	python3-dev
	"
checkdepends="
	py3-dateutil
	py3-numpy
	py3-pytest
	py3-tz
	tzdata
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ijl/orjson/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/orjson-$pkgver"
options="net"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--config-json '{"build-args": "--frozen"}' \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
e0b9493314651c660b09f7f0fe6b4567444a8df0dc1f3f002d1ef9c822ff9341bf94cfbefdf2ce4e6b57661435c76593b59e90fcbb7a25ea39003cc93837bb83  py3-orjson-3.10.11.tar.gz
"
